package com.xkk.teamhomework;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RatingBar;
import android.widget.TextView;
import android.widget.Toast;
import android.view.View;
import android.view.View.OnClickListener;

public class InfoCommentActivity extends Activity {

	private String infoName;
	private String infoDeacription;
	
	private TextView infoNameText,infoDeacriptionText;	
	private RatingBar scoreRatingbar;
	private EditText infoContext;
	private Button btnCommit;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.infocomment_layout);
		
		infoNameText  = (TextView) findViewById(R.id.name);
		infoDeacriptionText  = (TextView)findViewById(R.id.deacription);
		scoreRatingbar  = (RatingBar) findViewById(R.id.scorerating);
		infoContext = (EditText) findViewById(R.id.infocontext);
		btnCommit = (Button) findViewById(R.id.btncommit);
		btnCommit.setOnClickListener(new ViewOcl());
		
		/*//Bundle myBundle = this.getIntent().getExtras();
		String name = null;//= myBundle.getString("infoNameText");
		String description =null;//= myBundle.getString("infoDeacriptionText");
		if(name.isEmpty())
			infoNameText.setText(name);
		else
			infoNameText.setText("unkown");
		
		if(description.isEmpty())
			infoDeacriptionText.setText(description);
		else
			infoDeacriptionText.setText("unkown");*/
	}
	
	private class ViewOcl implements OnClickListener
	{
		public void onClick(View v) {
			// TODO Auto-generated method stub
			switch (v.getId()) {
			case R.id.btncommit:
				Float score = scoreRatingbar.getRating();
				String infocontext = infoContext.getText().toString();
				Toast.makeText(InfoCommentActivity.this, infocontext + " " + score.toString(), 1).show();
				break;

			default:
				break;
			}
		}
	}

	
	
}
